//
// Created by 李传智 on 2018/5/1.
//

#ifndef ANDSDK_FFRECORDER_H
#define ANDSDK_FFRECORDER_H

#include <list>
#include "IRecorder.h"

extern "C" {
#include <libavformat/avformat.h>
}

class FFRecorder : public IRecorder {

public:

    // 打开录制的输出文件
    virtual bool open(const char *url, CodecParameter outAudioParam, CodecParameter outVideoParam);

    // 结束录制
    virtual bool close();

protected:

    // 录制音视频
    virtual bool record(VideoData data);

    // 输出格式上下文
    AVFormatContext *fmtContext = 0;

    std::mutex mutex;

    bool isFirst = true;

    int64_t audioPts, videoPts;
};


#endif //ANDSDK_FFRECORDER_H
